package com.aizuda.boot.modules.flw.entity.dto;

import com.aizuda.bpm.engine.core.FlowCreator;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.PositiveOrZero;
import lombok.Getter;
import lombok.Setter;

/**
 * 流程任务分派（委派、转办） DTO
 *
 * @author 青苗
 * @since 2024-03-08
 */
@Getter
@Setter
public class TaskAssigneeDTO {

    @Schema(description = "流程任务ID")
    @NotNull
    @PositiveOrZero
    private Long taskId;

    @Schema(description = "类型 0，转办 1，委派")
    @NotNull
    private Integer type;

    @Schema(description = "用户ID")
    @NotNull
    @PositiveOrZero
    private Long userId;

    @Schema(description = "用户名")
    @NotBlank
    private String username;

    @Schema(description = "意见评论")
    private String content;

    @Schema(description = "是否是干预操作")
    private Boolean intervene = false;

    public FlowCreator toFlowCreator() {
        return FlowCreator.of(String.valueOf(this.userId), this.username);
    }
}
